﻿namespace Leetcode.N0014;
public class Solution
{
    public string LongestCommonPrefix(string[] strs)
    {
        for (int i = 0; i < strs[0].Length; i++)
        {
            for (int j = 1; j < strs.Length; j++)
            {
                if (i >= strs[j].Length || strs[j][i] != strs[0][i])
                {
                    return (i > 0) ? strs[0].Substring(0, i) : string.Empty;
                }
            }
        }
        return strs[0];
    }
}
